package com.keiou.drink.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.keiou.drink.R;

/**
 * Created by tjy on 2017/6/19.
 */
public class LoadingDialog extends Dialog {


    private TextView tvTip;
    private Context context;

    public LoadingDialog(Context context) {
        super(context, R.style.MyDialogStyle);

    }

    public LoadingDialog(Context context, int themeResId) {
        super(context, themeResId);
        this.context = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_loading);
        initView();
    }

    private void initView() {

        tvTip = (TextView) findViewById(R.id.tv_dialog_tip);
    }

    public void setTip(String tip) {
        if(null == tvTip) return;
        if (TextUtils.isEmpty(tip)) {
            tvTip.setVisibility(View.GONE);
        } else {
            tvTip.setText(tip);
            tvTip.setVisibility(View.VISIBLE);
        }
    }

}
